home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
SAT 2.3.8
/
Libraries & Documentation
/
Add-ons
/
Sprite behavior
/
SATGridStubs.p
next >
Wrap
Text File
|
1995-09-15
|
2KB
|
92 lines
{*** This copy of SATGridStubs modified for <your project here>! ***}
{=====================================================}
{============= Grid display grid-bound animation ==============}
{=====================================================}
{SATGridStubs is the non-reusable part of the SATGridToolbox and SATStrictGridToolbox units in the SAT Add-ons.}
{You should make a copy for your project and modify it to suit your needs.}
{Here you define the shape and size of your grid, and define how to draw it.}
{You need a separate version of this file for every game.}
unit SATGridStubs;
interface
uses
SAT;
type
GridSpaceType = Char;
const
kFreeSpace = ' ';
kArraySizeH = 15;
kArraySizeV = 12;
(*Size of the tiles*)
kTileSizeH = 24;
kTileSizeV = 24;
var
tileArray: packed array[0..kArraySizeH, 0..kArraySizeV] of Char;
procedure InitTiles;
procedure DrawTile (h: Integer; v: Integer);
implementation
(* Pictures used for drawing the grid, in DrawTile. *)
(* Feel free to replace them with, for example, FacePtrs as needed. *)
(* (Using Faces instead of Pictures would be a lot faster!) *)
var
wallTile, floorTile: PicHandle;
(* Preload graphics used by DrawTile! *)
procedure InitTiles;
var
h, v: Integer;
begin
wallTile := GetPicture(128);
floorTile := GetPicture(129);
for h := 0 to kArraySizeH do
for v := 0 to kArraySizeV do
begin
tileArray[h, v] := kFreeSpace;
end;
tileArray[5, 5] := 'x';
tileArray[6, 5] := 'x';
tileArray[7, 5] := 'x';
tileArray[7, 8] := 'x';
tileArray[8, 8] := 'x';
tileArray[9, 8] := 'x';
tileArray[7, 3] := 'x';
tileArray[8, 3] := 'x';
tileArray[9, 3] := 'x';
tileArray[10, 3] := 'x';
tileArray[11, 3] := 'x';
tileArray[5, 6] := 'x';
tileArray[5, 7] := 'x';
tileArray[5, 8] := 'x';
end;
(* Draw a tile *)
procedure DrawTile (h: Integer; v: Integer);
var
tileRectangle: Rect;
begin
SetRect(tileRectangle, h * kTileSizeH, v * kTileSizeV, (h + 1) * kTileSizeH, (v + 1) * kTileSizeV);
if (tileArray[h][v] = kFreeSpace) then
DrawPicture(floorTile, tileRectangle)
else
DrawPicture(wallTile, tileRectangle);
end; (*DrawTile*)
end.